home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1996 / MacHack 1996.toast / Hacks / Hacks ’95 / Desktop Pets / LayerMgr.h < prev    next >
Text File  |  1995-08-28  |  2KB  |  57 lines

  1. /* Layers.h */
  2.  
  3. /* Part of the undocumented Layer Manager structures and calls
  4.  * Information found with the help of MacsBug under MacOS 7.0.
  5.  *
  6.  * What I found was that a layer is associated with each running
  7.  * applications (if it has a user-interface), which groups all
  8.  * windows of that application. This is how you can hide an application
  9.  * (remember 'applications' menu under system 7) and get the list of
  10.  * other applications windows. Have fun.
  11.  */
  12.  
  13. #include <Processes.h>
  14.  
  15. // LayerRecord is similar to a WindowRecord.
  16. typedef WindowRecord LayerRecord;
  17. typedef WindowPeek LayerPtr;
  18.  
  19. // This records some information on the process which owns
  20. // the layer... Most of it is not clear (there are pointers
  21. // to other LayerRecords, to a heap zone, etc. in the unknown
  22. // parts)
  23. typedef struct {
  24.    long    unknown1;
  25.    OSType                signature;           // The process sig.
  26.    OSType                creator;             // The process creator
  27.    char                  unknown2[24];
  28.    ProcessSerialNumber     layerPSN;             // The process PSN
  29.    char                 unknown3[40];
  30.    Handle               moreLayerInfo;       // This handle is 212 bytes sized.
  31. } LayerInfo, *LayerInfoPtr;
  32.  
  33. // This function returns a pointer to the first layer record
  34. // of the front layer on screen (front application).
  35. // Other ones are then accessed by the GetNextLayer macro.
  36. pascal LayerPtr GetFirstLayer(void) TWOWORDINLINE (0x7003, 0xA829);
  37.  
  38. // This function returns a pointer to the first window record
  39. // in the windows list of this layer.
  40. pascal WindowPtr GetFirstLayerWindow(LayerPtr aLayer) TWOWORDINLINE (0x7006, 0xa829);
  41.  
  42. // Some macros to access other information, and to hide and show a layer
  43. #define GetNextLayer(aLayer) (aLayer->nextWindow)
  44. #define GetLayerInfo(aLayer) ((LayerInfoPtr)aLayer->refCon)
  45. #define HideLayer(aLayer) HideWindow((WindowPtr)aLayer)
  46. #define ShowLayer(aLayer) ShowWindow((WindowPtr)aLayer)
  47. #define ShowHideLayer(aLayer,showFlag) ShowHide((WindowPtr)aLayer,showFlag)
  48. #define HiddenLayer(aLayer) aLayer->visible
  49.  
  50. // GetLayerName will return an address in a handle. Be aware of that.
  51. #define GetLayerName(aLayer) (unsigned char *) ( (*GetLayerInfo(aLayer)->moreLayerInfo) + 0x38)
  52.  
  53.  
  54. // Prototypes
  55. LayerPtr FindLayerForSignature(OSType processSig);
  56. WindowPtr GetFrontWindowForSignature(OSType processSig);
  57.